package com.tom.hook;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.os.Environment;
import android.view.View;

import com.tom.hook.plugin.PluginManager;

import java.io.File;

public class HookActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_hook);
    }

    public void jumpPage(View view) {
        try {
            Intent intent = new Intent();
            // intent.setClass(this, Class.forName("com.tom.hook.TestActivity"));
            intent.setClass(this, Class.forName("com.hc.yaoyiyao.MainActivity"));
            intent.putExtra("user_name", "zhangSan");
            startActivity(intent);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
    }

    // 插件apk 存放的路径
    private String apkPath = Environment.getExternalStorageDirectory().getAbsolutePath()
            + File.separator + "yaoyiyao_plugin.apk";
    // 安装插件
    public void install(View view) {
        PluginManager.install(this, apkPath);
    }

}